<template>
  <div class="question">
    <div v-if="questionType=='0'||questionType=='1'||questionType=='11'" >
      <span class="q-title" v-html="question.title"/>
      <span class="q-title">({{question.score}}分)</span>
      <div class="q-content">
          <span :key="index" v-for="(option,index) in question.options" class="q-item-contain">
            <span class="q-option-seqCode">
              <el-checkbox v-model="option.answerFlag" onclick="return false">{{option.seqCode+'、'}}</el-checkbox >
            </span>
            <span v-html="option.content" class="q-option-content"></span>
            <br/>
          </span>
      </div>
      <div>
        <el-form-item label="结果:">
          <dict-tag :options="dict.type.answer_correct" :value="question.correct"/>
        </el-form-item>
        <el-form-item label="得分:">
          {{question.examineeScore}}
        </el-form-item>
        <el-form-item label="答题结果:">
            <span :key="index" v-for="(option,index) in question.options" class="q-item-contain">
              <span class="q-option-seqCode" v-if="option.answerFlag==true">{{option.seqCode+' '}}</span>
            </span>
        </el-form-item>
        <el-form-item label="正确答案:">
            {{question.answer}}
        </el-form-item>
        <el-form-item label="解析:">
            {{question.explain}}
        </el-form-item>
      </div>
    </div>
    <div v-else-if="questionType>='2'&&questionType<='6'" >
      <span class="q-title" v-html="question.title"/>
      <span class="q-title">({{question.score}}分)</span>
      <div>
        <el-form-item label="答题结果:">
            <span :key="index" v-for="(answer,index) in question.answers" class="q-item-contain">
              <span class="q-option-seqCode">{{(index+1)+'、'}}</span>
              <!-- <span  v-html="answer.answer"></span> -->
              <span  v-html="answer.examineeAnswer"></span>
              <span>(得分:{{answer.examineeScore}})</span>
              <br/>
              <span>
              得分：<el-input-number v-model="answer.examineeScore" :min="0.0" :max="answer.score" required/>
              </span>
              <br/>
            </span>
        </el-form-item>
        <el-form-item label="正确答案:">
          <span :key="index" v-for="(answer,index) in question.answers" class="q-item-answer">
            <span class="q-option-seqCode">{{(index+1)+'、'}}</span>
            <span  v-html="answer.answer"></span>
            <span>(分值:{{answer.score}})</span>
            <br/>
          </span>
        </el-form-item>
        <el-form-item label="解析:">
          <span v-html="question.explain" class="q-option-explain"></span>
        </el-form-item>
      </div>
    </div>
    <div v-else-if="questionType=='7'" >
      <div class="q-content">
          <span :key="index" v-for="(option,index) in question.options" class="q-item-contain">
            <span class="q-option-seqCode">{{option.seqCode+'、'}}</span>
            <span v-html="option.content" class="q-option-content"></span>
            <br/>
          </span>
      </div>
      <div  :key="index"  v-for="(choice,index) in question.choices">
        {{(index+1)+'：'}}<div class="question-sub-title" v-html="choice.title"/>
        <span class="q-title">({{choice.score}}分)</span>
        <el-form-item label="答题结果:">
          <span class="q-option-seqCode">
            <el-radio-group v-model="choice.examineeAnswer" readOnly>
              <el-radio v-for="option in question.options" :key="option.seqCode" :label="option.seqCode" onclick="return false">{{option.seqCode}}</el-radio>
            </el-radio-group>
          </span>
        </el-form-item>
        <el-form-item label="结果:">
          <dict-tag :options="dict.type.answer_correct" :value="choice.correct"/>
        </el-form-item>
        <el-form-item label="小题得分:">
          {{choice.examineeScore}}
        </el-form-item>
        <el-form-item label="正确答案:">
          {{choice.answer}}
        </el-form-item>
        <el-form-item label="解析:">
          <span v-html="choice.explain" class="q-option-explain"></span>
        </el-form-item>
      </div>
      <div>
        <el-form-item label="得分:">
          {{question.examineeScore}}
        </el-form-item>
      </div>
    </div>
    <div v-else-if="questionType=='8'||questionType=='9'" >
      <span class="q-title" v-html="question.title"/>
      <span class="q-title">({{question.score}}分)</span>
      <div class="q-content" :key="index"  v-for="(subQuestion,index) in question.questions" >
          <div>
            {{(index+1)+'：'}}<span class="question-sub-title" v-html="subQuestion.title"/>
            <span class="q-title">({{subQuestion.score}}分)</span>
            <br/>
            <span  class="q-item-contain" :key="option.seqCode"  v-for="option in subQuestion.options" >
              <span class="q-option-seqCode">
                <el-checkbox v-model="option.answerFlag" onclick="return false">{{option.seqCode+'、'}}</el-checkbox >
              </span>
              <span v-html="option.content" class="q-option-content"></span>
              <br/>
            </span>
          </div>
          <div>
            <el-form-item label="答题结果:">
                <span :key="index" v-for="(option,index) in subQuestion.options" class="q-item-contain">
                  <span class="q-option-seqCode" v-if="option.answerFlag==true">{{option.seqCode+' '}}</span>
                </span>
            </el-form-item> 
            <el-form-item label="结果:">
              <dict-tag :options="dict.type.answer_correct" :value="subQuestion.correct"/>
            </el-form-item>
            <el-form-item label="小题得分:">
              {{subQuestion.examineeScore}}
            </el-form-item>
            <el-form-item label="正确答案:">
               {{subQuestion.answer}}
            </el-form-item>
            <el-form-item label="解析:">
              <span v-html="subQuestion.explain" class="q-option-explain"></span>
            </el-form-item>
          </div>
      </div>
    </div>
    <div v-else-if="questionType=='10'" >
      <div class="q-title" v-html="question.title"/>
      <div>
        <el-form-item label="答题结果" >
              <el-radio-group v-model="question.answerFlag" readOnly>
                <el-radio label="1">是</el-radio>
                <el-radio label="0">否</el-radio>
              </el-radio-group>
        </el-form-item>
        <el-form-item label="结果:">
          <dict-tag :options="dict.type.answer_correct" :value="question.correct"/>
        </el-form-item>
        <el-form-item label="得分:">
          {{question.examineeScore}}
        </el-form-item>
        <el-form-item label="正确答案:">
          {{question.answer}}
        </el-form-item>
      </div>
    </div>
  </div>

</template>

<script>
export default {
  name: 'examQuestion',
  dicts: ['answer_correct'],
  props: {
    question: {
      type: Object,
      default: function () {
        return {}
      }
    },
    questionType: {
      type: String,
      default: 0
    }
  },
  methods: {
  }
}
</script>
